﻿using JobManageCommon.IniConfig;

namespace JobManageBLL.Config
{
    public class DBConfig
    {
        public string inipath;
        public DBConfig(string INIPath)
        {
            inipath = INIPath; 
        }
        /// <summary>
        /// 写入
        /// </summary>
        /// <param name="Section"></param>
        /// <param name="Key"></param>
        /// <param name="Value"></param>
        public bool IniWriteValue(string Section, string Key, string Value) {    
        IniFiles IniFiles = new IniFiles(inipath);
        return   IniFiles.IniWriteValue(Section,Key,Value);
        }
        /// <summary>
        /// 读取
        /// </summary>
        /// <param name="Section"></param>
        /// <param name="Key"></param>
        /// <param name="Value"></param>
        public string IniReadValue(string Section, string Key)
        {
            IniFiles IniFiles = new IniFiles(inipath);
            var isok=   IniFiles.ExistINIFile(inipath);
            if (isok)
            {
                return IniFiles.IniReadValue(Section, Key);
            }
            else {
                return "";
            }
        }
        /// <summary>
        /// 判断是否存在
        /// </summary>
        /// <returns></returns>
        public bool existini()
        {
            IniFiles IniFiles = new IniFiles(inipath);
            var isok = IniFiles.ExistINIFile(inipath);
            if (!isok)
            {
                return false;
            }
            return true;
        }
    }
}
